package com.fourth.entity;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigInteger;

/**
 * 如果对于spring validation不会使用请访问以下网站
 *  中文参考：
 *      https://xiaoym.gitee.io/knife4j/documentation/get_start.html
 *  官方参考：
 *      https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/
 *
 *  对于 swagger注解不熟悉请参考以下地址
 *      https://github.com/swagger-api/swagger-core/wiki/Annotations
 *
 * @author 邓建波
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("knife4j和validation用例")
public class Test {
    @NotNull
    private BigInteger id;
    private String name;
    @Size(min = 11, max = 11)
    private String phone;
    @Email
    private String email;
    @Range(max = 150, min = 1, message = "年龄范围应该在1~150之内")
    private Integer age;
}
